﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LocalizationTest.Tools
{
  public abstract class MathTools
  {
    public static double NormalizeSmall(double angle)
    {
      double toReturn = angle;
      if (toReturn < -Math.PI) toReturn += 2.0 * Math.PI;
      if (toReturn > Math.PI) toReturn -= 2.0 * Math.PI;
      if (toReturn < -Math.PI / 2.0) toReturn += Math.PI;
      if (toReturn > Math.PI / 2.0) toReturn -= Math.PI;
      return toReturn;
    }

    public static double Normalize(double angle)
    {
      double toReturn = angle;
      if (toReturn < -Math.PI) toReturn += 2.0 * Math.PI;
      if (toReturn > Math.PI) toReturn -= 2.0 * Math.PI;
      return toReturn;
    }
  }
}
